package com.top.art.converter;

import com.top.art.bo.UserBO;
import com.top.art.bo.UserUpdateBO;
import com.top.art.entity.UserInfo;
import com.top.art.vo.AccountInfoVO;
import com.top.art.vo.UserInfoVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * The interface Alarm mapper.
 *
 * @author hjh
 */
@Mapper(componentModel = "spring")
public interface UserInfoConverter {

    /**
     * Dto 2 vo alarm vo.
     *
     * @param model the model
     * @return the alarm vo
     */
    AccountInfoVO do2vo(UserInfo model);

    /**
     * Bo 2 do user info.
     *
     * @param bo the bo
     * @return the user info
     */
    UserInfo bo2do(UserBO bo);

    /**
     * Do 2 user vo user info vo.
     *
     * @param model the model
     * @return the user info vo
     */
    UserInfoVO do2userVO(UserInfo model);

    /**
     * Dos 2 user v os list.
     *
     * @param dos the dos
     * @return the list
     */
    List<UserInfoVO> dos2userVOs(List<UserInfo> dos);

    /**
     * Bo 2 do user info.
     *
     * @param bo the bo
     * @return the user info
     */
    @Mappings({
            @Mapping(target = "enable", expression = "java(bo.getEnable()==null?null:(bo.getEnable()==1?true:false))"),
    })
    UserInfo bo2do(UserUpdateBO bo);
}

